<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .img{
            width: 200px;
            height: 200px;
            background: no-repeat;
            background-size: contain;
            float: left;
        }
        #div1{
            background-image: url("imgs/1.jpg");
        }
        #div2{
            background-image: url("imgs/2.jpg");
        }
        #div3{
            background-image: url("imgs/3.jpg");
        }
        #div4{
            background-image: url("imgs/4.jpg");
        }
        .kk{
            background-color: green;
            width: 200px;
            height: 200px;
            /* 清除浮动 */
            clear: both;
        }
    </style>
</head>
<body>
    <div class="img" id="div1"></div>
    <div class="img" id="div2"></div>
    <div class="img" id="div3"></div>
    <div class="img" id="div4"></div>
    <div class="kk"></div>
</body>
</html>